int ldrPin = 0; // select the input pin for the light sensor/resistor
int ledPin = 9; // select the pin for the LED
int lightVal = 0; // variable to store the value coming from the sensor
 
void setup() {
  Serial.begin(9600); 
  pinMode(ldrPin, INPUT); // declare the LDR as an INPUT
  pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
}
 
void loop() {
  lightVal = analogRead(ldrPin); // read the value from the sensor
//  Serial.print(lightVal);
//  Serial.println("");
  if (lightVal > 350)
    digitalWrite(ledPin, HIGH); //Sensor a oscuras
  else
    digitalWrite(ledPin, LOW);
delay(200);
  
}
